package com.socialrss.accounts.factoryobject;

import android.content.ContentValues;
import android.database.Cursor;

import com.socialrss.accounts.AbstractNotification;
import com.socialrss.accounts.InstagramNotification;
import com.socialrss.accounts.dbinterfaces.IInstagramNotificationTable;

public class InstagramNotificationFactory extends AbstractNotificationFactory{
	private int userid;
	public InstagramNotificationFactory(int userid){
		this.userid= userid;
	}
	/**
	 * First column : id
	 * Second column: link
	 * Third column : image content link
	 * Fourth column: date
	 */
	@Override
	public AbstractNotification turnToObject(Cursor cur){
		InstagramNotification value = new InstagramNotification();
		value.setId(cur.getInt(0));
		value.setLink(cur.getString(1));
		value.setImageContentLink(cur.getString(2));
		value.setDate(cur.getInt(3));
		return value;
	}

	@Override
	public ContentValues turnToDBInput(AbstractNotification temp) {
		ContentValues values = new ContentValues();
		values.put(IInstagramNotificationTable.USER_ID, userid);
		values.put(IInstagramNotificationTable.POST_LINK, temp.getLink());
		values.put(IInstagramNotificationTable.IMAGE_LINK, ((InstagramNotification)temp).getImageContentLink());
		values.put(IInstagramNotificationTable.POST_DATE, temp.getDate());
		
		return values;
	}
	public void setUserId(int userid){
		this.userid = userid;
	}
}
